/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.camera.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.PreferenceGroup;
import com.android.camera.R;

/**
 * The IndicatorControlBarContainer is a IndicatorControl containing
 * IndicatorControlBar, SecondIndicatorControlBar and ZoomControlBar for Phone UI.
 */
public class IndicatorZoomControlBarContainer extends IndicatorControlContainer {
    private static final String TAG = "IndicatorZoomControlBarContainer";


    private IndicatorZoomControlBar mIndicatorControlBar;


    public IndicatorZoomControlBarContainer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        mIndicatorControlBar = (IndicatorZoomControlBar)
                findViewById(R.id.indicator_zoom_bar);
        mIndicatorControlBar.setOnIndicatorEventListener(this);
    }

    @Override
    public void initialize(Context context, PreferenceGroup group,
            boolean isZoomSupported, String[] secondLevelKeys,
            String[] secondLevelOtherSettingKeys) {

        mIndicatorControlBar.initialize(context, group, isZoomSupported);

    }

    public void setOrientation(int orientation) {
        mIndicatorControlBar.setOrientation(orientation); 
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (mIndicatorControlBar.getVisibility() == View.VISIBLE) {
            return mIndicatorControlBar.dispatchTouchEvent(event);
        }
        return true;
    }


    

    public void reloadPreferences() {
        mIndicatorControlBar.reloadPreferences(); 
    }

    public void setListener(OnPreferenceChangedListener listener) {
        mIndicatorControlBar.setListener(listener); 
    }

    @Override
    public View getActiveSettingPopup() {
        if (mIndicatorControlBar.getVisibility() == View.VISIBLE) {
            return mIndicatorControlBar.getActiveSettingPopup();
        }
        return null;
    }

    public boolean dismissSettingPopup() {
        if (mIndicatorControlBar.getVisibility() == View.VISIBLE) {
            return mIndicatorControlBar.dismissSettingPopup();
        }
        return false;
    }

  

    @Override
    public void setEnabled(boolean enabled) {
        mIndicatorControlBar.setEnabled(enabled);
    }

    @Override
    public void enableZoom(boolean enabled) {
        mIndicatorControlBar.enableZoom(enabled);
    }

    //Mediatek modify end

    @Override
    public void onIndicatorEvent(int event) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void dismissSecondLevelIndicator() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void disableCameraPicker() {
        // TODO Auto-generated method stub
        
    }
}
